package day05;

import java.util.Scanner;

//随机加法运算器
public class Addition {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int score = 0;
        for (int i =1 ; i<=10;i++){
            //1.出题  2.答题   3.判断
            int a = (int)(Math.random()*100);//加数a(0到99)
            int b = (int) (Math.random()*100);//加数b(0到99)
            int result = a+b;//存正确答案
            System.out.println("("+i+")"+a+"+"+b+"=?");//出题
            System.out.println("答题吧");
            int num = scan.nextInt();//答题
            if (num == result) {//判题
                System.out.println("答对了");
                score += 10;//答对加10分
            }else {
                System.out.println("答错了");
            }
        }
        System.out.println("总分为:"+score);
    }

}
